package cn.uce.cc.srv.utils;


import cn.uce.utils.StringUtil;
import org.apache.commons.lang.time.FastDateFormat;

import java.util.Date;

public class DateUtil {

    public static final String PATTERN_TIME = "yyyy-MM-dd HH:mm:ss";

    public static String dateToString(Date date, String pattern) {
        if (date == null)
            return "";
        if (StringUtil.isBlank(pattern))
            pattern = PATTERN_TIME;
        FastDateFormat fastDateFormat = FastDateFormat.getInstance(pattern);
        return fastDateFormat.format(date);
    }
}
